"""
 落球计算
 ▪ 一球从100米高度自由落下，假设每次落地后 反跳回原高度的一半；再落下，再弹起。请 问第6次落地后会弹起多少米？
 ▪ 请分别使用for循环与while循环。并使用break与 contiune流程控制关键字
"""
def testFor():
    height = 100
    for i in range(6):
        height = height / 2
    return height

def testWhile():
    height = 100
    i = 0
    while(True):
        height = height /2
        i = i + 1
        if (i == 6):
            break
    return height

h = testFor()
print("for:{}".format(h))
h = testWhile()
print("while:{}".format(h))


"""
   "source": [
    "b=100;i=0\n",
    "while b>10e-3:\n",
    "    b/=2\n",
    "    i+=1\n",
    "    while i==6:\n",
    "        print('height:',b,'times:',i)\n",
    "        break"
   ]
"""

b=100;i=0
while b>10e-3:
    b/=2
    i+=1
    while i==6:
        print('height:',b,'times:',i)
        break

#测试通过